package cn.rkylin.oms.refund.dao.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import cn.rkylin.core.IDataBaseFactory;
import cn.rkylin.oms.refund.dao.IEcRefundDAO;
import cn.rkylin.oms.refund.vo.EcRefundVO;

/**
 * 类名:EcRefundDAOImpl <br/>
 * 作用: 平台退款单数据访问对象. <br/>
 * 创建原因: 平台退款单数据访问对象 <br/>
 * 创建时间: 2017年9月22日 下午2:09:22 <br/>
 * 
 * @author zhanghao
 * @version v1.0
 */
@Repository(value = "ecRefundDAO")
public class EcRefundDAOImpl implements IEcRefundDAO {
    @Autowired
    protected IDataBaseFactory dao;

    public EcRefundDAOImpl() {

    }

    private String STATEMENT_SELECT_ECREFUND_4_AUTO_DOWNLOAD = "selectEcRefund4AutoDownload";
    private String STATEMENT_SELECT_ECREFUND_4_AUTO_UPDATE = "selectEcRefund4AutoUpdate";
    private String STATEMENT_UPDATE_BATCH_ECREFUND_INSERT_STATUAS = "updateEcRefundInsertStatus";
    private String STATEMENT_UPDATE_BATCH_RETURN_INSERT_STATUAS = "updateReturnInsertStatus";

    /**
     * 查询即将执行自动下载的平台退款单列表.
     * 
     * @see cn.rkylin.oms.refund.dao.IEcRefundDAO#selectEcRefund(cn.rkylin.oms.refund.vo.EcRefundVO)
     */
    @Override
    public List<EcRefundVO> selectEcRefund4AutoDownload(EcRefundVO ecRefundVO) throws Exception {
        List<EcRefundVO> returnList = null;
        returnList = dao.findAllList(STATEMENT_SELECT_ECREFUND_4_AUTO_DOWNLOAD, ecRefundVO);
        return returnList;
    }

    /**
     * 批量设置平台退款单已经进系统.
     * @throws Exception 
     * 
     * @see cn.rkylin.oms.refund.dao.IEcRefundDAO#updateBatchInsertStatus(java.util.List)
     */
    @Override
    public int updateBatchInsertStatus(List<EcRefundVO> ecRefundList) throws Exception {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("ecRefundList", ecRefundList);
        return dao.update(STATEMENT_UPDATE_BATCH_ECREFUND_INSERT_STATUAS, paramMap);
    }
    /**
     * 批量设置平台退款单已经进系统.
     * @throws Exception 
     * 
     * @see cn.rkylin.oms.refund.dao.IEcRefundDAO#updateBatchInsertStatus(java.util.List)
     */
    @Override
    public int updateBatchReturnInsertStatus(List<EcRefundVO> ecRefundList) throws Exception {
        Map<String,Object> paramMap = new HashMap<String,Object>();
        paramMap.put("ecRefundList", ecRefundList);
        return dao.update(STATEMENT_UPDATE_BATCH_RETURN_INSERT_STATUAS, paramMap);
    }

    /**
     * 查询即将执行更新的平台退款单列表..
     * @see cn.rkylin.oms.refund.dao.IEcRefundDAO#selectEcRefund4AutoUpdate(cn.rkylin.oms.refund.vo.EcRefundVO)
     */
    @Override
    public List<EcRefundVO> selectEcRefund4AutoUpdate(EcRefundVO ecRefundVO) throws Exception {
        List<EcRefundVO> returnList = null;
        returnList = dao.findAllList(STATEMENT_SELECT_ECREFUND_4_AUTO_UPDATE, ecRefundVO);
        return returnList;
    }
}
